package com.atguigu.gmall.payment.controller;

import com.alipay.api.AlipayApiException;
import com.atguigu.gmall.payment.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:lyd
 * @Date:2023/9/6 19:36
 * @Version:1.0
 * @Description
 **/
@RestController
@RequestMapping("/api/payment")
public class PayResultController {

    @Autowired
    PayService payService;

    /**
     * 获取支付宝二维码的界面
     * @param orderId
     * @return
     */
    @GetMapping("/alipay/submit/{orderId}")
    public String alipayPage(@PathVariable Long orderId) throws AlipayApiException {
        String html = payService.getPayPage(orderId);
        return html;
    }
}
